In [76]:
from datetime import date, time, datetime
import tables as tbl
# Not sure this is actually useful...
# import cytoolz as toolz
import sas7bdat as sas

In [276]:
sas_nbbo = sas.SAS7BDAT('./sas_data/nbbo_20110103.sas7bdat')
quotes = sas.SAS7BDAT('./sas_data/cqm_20110103.sas7bdat')

In [277]:
it = quotes.readlines()
it.next()


Out[277]:
[u'PERMNO',
 u'group',
 u'sym_root',
 u'time_mtrail',
 u'TIME_M',
 u'EX',
 u'SYM_SUFFIX',
 u'BID',
 u'BIDSIZ',
 u'ASK',
 u'ASKSIZ',
 u'time_mroot']

In [355]:
it.next()


Out[355]:
[10180.0,
 3.0,
 u'AKRX',
 23.0,
 datetime.time(9, 46, 37, 23000),
 u'C',
 u'',
 0.0,
 0.0,
 0.0,
 0.0,
 35197.0]

In [4]:
sas_nbbo.header


Out[4]:
Header:
	col_count_p1: 43
	col_count_p2: 0
	column_count: 43
	compression: None
	creator: None
	creator_proc: DATASTEP
	date_created: 2015-03-20 10:13:06.208597
	date_modified: 2015-03-20 10:13:06.208597
	endianess: little
	file_type: DATA
	filename: nbbo_20110103.sas7bdat
	header_length: 8192
	lcp: 8
	lcs: 0
	mix_page_row_count: 63
	name: NBBO_20110103
	os_name: x86_64
	os_type: 2.6.32-504.1.3.e
	page_count: 382011
	page_length: 24576
	platform: unix
	row_count: 34380918
	row_length: 272
	sas_release: 9.0301M0
	server_type: Linux
	u64: True

Contents of dataset "NBBO_20110103":
Num Name          Type   Length Format Label                                               
--- ------------- ------ ------ ------ ----------------------------------------------------
  1 PERMNO        number      8        PERMNO                                              
  2 group         number      3                                                            
  3 sym_root      string     10        Security symbol root                                
  4 time_mtrail   number      3                                                            
  5 TIME_M        number      8 TIME   Time of Trade or Quote with milliseconds (HHMMSSXXX)
  6 SYM_SUFFIX    string     10        Security symbol suffix                              
  7 time_mroot    number      8                                                            
  8 spread_tiny   number      3                                                            
  9 spread_L0     number      3                                                            
 10 spread_M1     number      3                                                            
 11 spread_M2     number      3                                                            
 12 spread_M3     number      3                                                            
 13 spread_M4     number      3                                                            
 14 spread_M5     number      3                                                            
 15 spread_M6     number      3                                                            
 16 spread_M7     number      3                                                            
 17 spread_M8     number      3                                                            
 18 spread_M9     number      3                                                            
 19 spread_M10    number      3                                                            
 20 qb            number      4                                                            
 21 BBid          number      8                                                            
 22 BAsk          number      8                                                            
 23 spread        number      8                                                            
 24 mpspread      number      8                                                            
 25 BBid2dig      number      8                                                            
 26 BAsk2dig      number      8                                                            
 27 BBidsiz       number      8                                                            
 28 BAsksiz       number      8                                                            
 29 BBidgap       number      3                                                            
 30 BAskgap       number      3                                                            
 31 BBid2diggap   number      3                                                            
 32 BAsk2diggap   number      3                                                            
 33 time_mwgt     number      8                                                            
 34 exAtBBid      string     17                                                            
 35 exAtBAsk      string     17                                                            
 36 rebBBid_hival number      8                                                            
 37 rebBBid_loval number      8                                                            
 38 rebBAsk_hival number      8                                                            
 39 rebBAsk_loval number      8                                                            
 40 feeBBid_hival number      8                                                            
 41 feeBBid_loval number      8                                                            
 42 feeBAsk_hival number      8                                                            
 43 feeBAsk_loval number      8                                                            

In [20]:
quotes.header


Out[20]:
Header:
	col_count_p1: 12
	col_count_p2: 0
	column_count: 12
	compression: None
	creator: None
	creator_proc: DATASTEP
	date_created: 2015-03-20 10:12:41.293534
	date_modified: 2015-03-20 10:12:41.293534
	endianess: little
	file_type: DATA
	filename: cqm_20110103.sas7bdat
	header_length: 8192
	lcp: 8
	lcs: 0
	mix_page_row_count: 58
	name: CQM_20110103
	os_name: x86_64
	os_type: 2.6.32-504.1.3.e
	page_count: 326492
	page_length: 8192
	platform: unix
	row_count: 32975567
	row_length: 80
	sas_release: 9.0301M0
	server_type: Linux
	u64: True

Contents of dataset "CQM_20110103":
Num Name        Type   Length Format Label                                               
--- ----------- ------ ------ ------ ----------------------------------------------------
  1 PERMNO      number      8        PERMNO                                              
  2 group       number      3                                                            
  3 sym_root    string     10        Security symbol root                                
  4 time_mtrail number      3                                                            
  5 TIME_M      number      8 TIME   Time of Trade or Quote with milliseconds (HHMMSSXXX)
  6 EX          string      1        Exchange that issued the quote                      
  7 SYM_SUFFIX  string     10        Security symbol suffix                              
  8 BID         number      8        Bid price                                           
  9 BIDSIZ      number      5        Bid size in units of trade                          
 10 ASK         number      8        Ask price                                           
 11 ASKSIZ      number      5        Ask size in units of trade                          
 12 time_mroot  number      8                                                            

In [249]:
PERMNO = 0
TIME_M = 4
EX = 5
BID = 7
sym_root = 2
time_mtrail = 3
time_mroot = 11

This is our target!


In [273]:
it = iter(sas_nbbo)
it.next()
first_row = it.next()

In [274]:
# PERMNO, BBid, time_mroot, time_mtrail, TIME_M
first_row[PERMNO], first_row[sym_root], first_row[20], first_row[6], first_row[3], first_row[TIME_M]


Out[274]:
(10180.0, u'AKRX', 6.07, 35108.0, 27.0, datetime.time(9, 45, 8, 27000))

In [275]:
second_row = it.next()
second_row[PERMNO], first_row[20]


Out[275]:
(10180.0, 6.07)

Some setup for our code


In [111]:
class ExchangeBids(tbl.IsDescription):
    '''Table structure for bids / exchange'''
    
    # HDF5 support for time is funny / annoying - so we don't use it
    time_mroot = tbl.Int32Col()
    time_mtrail = tbl.Int32Col()
    A = tbl.Float32Col(1, dflt=np.nan)
    B = tbl.Float32Col(1)
    C = tbl.Float32Col(1)
    D = tbl.Float32Col(1)
    I = tbl.Float32Col(1)
    J = tbl.Float32Col(1)
    K = tbl.Float32Col(1)
    M = tbl.Float32Col(1)
    N = tbl.Float32Col(1)
    T = tbl.Float32Col(1)
    P = tbl.Float32Col(1)
    S = tbl.Float32Col(1)
    Q = tbl.Float32Col(1)
    W = tbl.Float32Col(1)
    X = tbl.Float32Col(1)
    Y = tbl.Float32Col(1)
    Z = tbl.Float32Col(1)
    
def permno_row(permno):
    permno = int(permno)
    permno_table = h5f.create_table('/', 'p{}'.format(permno), ExchangeBids, 
                                    "Best bids for {}".format(permno))
    return permno_table.row

def record_time(row, time):
    row['time_mroot'] = time.hour * 24 * 60 + time.minute * 60 + time.second
    row['time_mtrail'] = time.microsecond * 1000

Testing use of HDF5


In [67]:
h5f = tbl.open_file('test.h5', mode='w')

In [112]:
t = h5f.create_table('/', 'p126', ExchangeBids)

In [114]:
r = t.row

In [101]:
time_m = first_row[TIME_M]

In [103]:
r['time_mroot'] = time_m.hour * 24 * 60 + time_m.minute * 60 + time_m.second

In [104]:
r['time_mtrail'] = time_m.microsecond

In [118]:
r['A'] = 2.45

In [119]:
r['A']


Out[119]:
array([ 2.45000005], dtype=float32)

In [120]:
r.append()

In [122]:
r['A']


Out[122]:
array([ nan], dtype=float32)

In [87]:
import pandas as pd

Done testing HDF5 - Compute the first tables!


In [259]:
tick = datetime.now()

it = quotes.readlines()
header = it.next()

curr_time = None
curr_permno = None
h5f = tbl.open_file("exchange_bids.h5", mode = "w", title = "Best bid per exchange")

for i, row in enumerate(it):
    permno = row[PERMNO]
    if curr_permno is None:
        # Our first security
        curr_permno = permno
        print permno, row[sym_root]
        out_row = permno_row(permno)
    elif curr_permno != permno:
        # We have a new security
        out_row.append()
        if permno == 0.0:
            # sas7bdat doesn't raise a StopIteration exception
            # it just starts returning empty rows
            break
        curr_permno = permno
        print permno, row[sym_root]
        curr_time = None
        out_row = permno_row(permno)
        
    if curr_time is None:
        curr_time = row[TIME_M]
        record_time(out_row, curr_time)
    elif curr_time != row[TIME_M]:
        curr_time = row[TIME_M]
        out_row.append()
        record_time(out_row, curr_time)

    
    ex = row[EX]
    if out_row[ex] == np.nan:
        out_row[ex] = row[BID]
    elif out_row[ex] < row[BID]:
        out_row[ex] = row[BID]
        
h5f.close()
tock = datetime.now()

print tock - tick


10180.0 AKRX
10201.0 AT
10258.0 CLDX
10333.0 XOMA
10838.0 CYTR
10860.0 OSUR
10952.0 CDR
11018.0 FBP
11056.0 STSA
11154.0 PLAB
11754.0 EK
11993.0 LPH
11999.0 MCP
12017.0 VRNG
12027.0 SMT
12049.0 GORO
12051.0 IL
12057.0 REE
12063.0 PARD
12090.0 TSRX
12149.0 CBRX
12169.0 DRL
12266.0 PPHM
12324.0 MY
12349.0 BODY
12359.0 NTSP
12360.0 PACB
12365.0 BITA
12389.0 TPLM
12398.0 GNOM
12409.0 SUNH
12411.0 TKMR
12413.0 ZGNX
12439.0 AVL
12444.0 DANG
12447.0 AG
12489.0 MOBI
15560.0 RSH
16505.0 BPOP
18033.0 SVNT
18148.0 SPEX
19828.0 WEN
20053.0 SNV
20670.0 CAMP
20765.0 GY
21020.0 AMR
21135.0 FOE
22323.0 ISR
22753.0 CHRS
23887.0 FTR
24441.0 CDE
29867.0 AOI
30796.0 GFI
31799.0 ELN
32540.0 ELX
32636.0 ENER
32651.0 HL
33137.0 ENZN
34666.0 NBS
34673.0 NR
35044.0 RF
37234.0 FST
39087.0 S
42024.0 OMX
42906.0 HBAN
43290.0 CYPB
43757.0 IMMU
44813.0 CVM
44951.0 SVU
46922.0 RAD
47677.0 CBB
47706.0 FSS
48267.0 LSI
48291.0 LTXC
49905.0 LIZ
49955.0 NXG
50286.0 LEE
51457.0 OSG
52337.0 THC
53613.0 MU
54148.0 PHM
57509.0 GDP
58675.0 PKD
59483.0 YRCW
61241.0 AMD
61955.0 PVA
62885.0 GBE
63079.0 KEG
63335.0 PDC
64629.0 MDR
65285.0 HOV
65509.0 BLC
66739.0 SFY
69446.0 VGZ
69980.0 GAB
70519.0 C
70704.0 UXG
70797.0 USA
72696.0 SPF
75175.0 MBI
75257.0 TLAB
75261.0 MNI
75326.0 ACI
75434.0 FSII
75454.0 EXM
75527.0 ZQK
75573.0 ODP
75672.0 URRE
75733.0 CKXE
75734.0 HNR
75811.0 MTU
75846.0 SFI
75853.0 ZIXI
75854.0 LSCC
76217.0 WTSL
76383.0 AVNR
76493.0 AIB
76532.0 TRGL
76584.0 ATML
76613.0 IO
76804.0 MTG
76858.0 JOEZ
76888.0 AXAS
76978.0 RTK
76999.0 THQI
77007.0 VVTV
77117.0 WNC
77158.0 KV
77175.0 AMSC
77205.0 ONTY
77413.0 SCLN
77437.0 STEM
77443.0 AERG
77570.0 TGB
77582.0 VLNC
77604.0 ALU
77643.0 FCF
77699.0 FCEL
77855.0 FBN
78001.0 KEM
78009.0 SBIB
78038.0 RDN
78051.0 QCOR
78073.0 SATC
78186.0 PQ
78208.0 TRID
78436.0 NGAS
78741.0 GBG
78841.0 EGY
78869.0 HEV
78889.0 GLBL
78999.0 PSUN
79022.0 VICL
79025.0 RPRX
79122.0 AMRN
79259.0 DPTR
79516.0 OXGN
79636.0 GSS
79672.0 ZLC
79712.0 LNET
79758.0 BYD
79853.0 PAL
79922.0 TLB
80004.0 MRNA
80019.0 PRKR
80049.0 TQNT
80069.0 ARWR
80180.0 GRT
80193.0 BZH
80303.0 AKS
80306.0 BCRX
80368.0 NEXS
80452.0 DARA
80485.0 VVUS
80539.0 NKTR
80560.0 NPSP
80670.0 AAI
80683.0 FR
80747.0 FCH
80758.0 EEE
80858.0 WAVX
80918.0 ARIA
80924.0 SIRI
80926.0 CPE
80943.0 MTSN
80962.0 CETV
81013.0 TSEM
81103.0 ROYL
81128.0 ESI
81530.0 PMI
81539.0 ANAD
81621.0 HLIT
81654.0 BGP
81666.0 HA
81669.0 PT
81776.0 WFR
81925.0 GTI
82156.0 DSCO
82165.0 CNLG
82231.0 CNU
82266.0 CVO
82513.0 PCYC
82540.0 WLT
82555.0 BLDP
82567.0 OPK
82575.0 BANR
82779.0 NVAX
82824.0 IDRA
83030.0 WL
83291.0 ELNK
83317.0 SUPG
83534.0 NBIX
83551.0 PCBC
83558.0 SRZ
83616.0 AFFX
83633.0 ELGX
83659.0 FXEN
83756.0 GERN
83762.0 HEB
83834.0 WG
83862.0 ETFC
83883.0 BIOS
83885.0 MVIS
83909.0 SSRI
83950.0 SPPI
83989.0 GTN
83992.0 IRE
84052.0 ARQL
84083.0 HMY
84108.0 UWBK
84330.0 PWAV
84342.0 MWW
84413.0 CERS
84416.0 CWTR
84511.0 ASTM
84521.0 CXM
84553.0 BPZ
84604.0 CTIC
84607.0 EMKR
84723.0 LNG
84734.0 FBC
84827.0 RMBS
85002.0 AVII
85032.0 Q
85035.0 RFMD
85061.0 KRY
85172.0 AEG
85177.0 EGHT
85271.0 ACAS
85293.0 ABIO
85349.0 ARM
85401.0 SIGA
85516.0 PWER
85522.0 AMCC
85571.0 PGNX
85602.0 SID
85611.0 HYC
85635.0 TLM
85686.0 DEPO
85724.0 CECO
85726.0 DENN
85739.0 MRGE
85744.0 RMTI
85772.0 RAS
85897.0 ANH
85905.0 DSU
85971.0 PAET
85991.0 LVLT
86042.0 HW
86047.0 AMKR
86143.0 VVR
86150.0 BEBE
86155.0 CMLS
86165.0 PEIX
86180.0 MIPS
86222.0 DHY
86233.0 USU
86249.0 CEDC
86270.0 ICOG
86440.0 WIBC
86444.0 INO
86496.0 CNXT
86563.0 HT
86685.0 CRBC
86715.0 COCO
86742.0 XING
86759.0 KWK
86822.0 EXTR
86840.0 PLXT
86866.0 TUES
86881.0 BRCD
86990.0 OPWV
87043.0 QTM
87084.0 VHC
87099.0 ARTG
87105.0 DSCM
87128.0 NOK
87129.0 CHIN
87131.0 KCG
87140.0 LAB
87165.0 MOVE
87204.0 CX
87209.0 MCZ
87261.0 UNTD
87279.0 NBG
87337.0 PLUG
87344.0 SIFY
87345.0 SIMG
87364.0 QUIK
87373.0 ALSK
87430.0 KTOS
87478.0 CALP
87487.0 BGCP
87508.0 NTWK
87583.0 AGEN
87584.0 ANPI
87618.0 MCCC
87632.0 SQNM
87750.0 ALTH
87771.0 GTIV
87816.0 CIGX
87825.0 UTSI
87833.0 NWD
87856.0 GLCH
88148.0 RPTP
88159.0 EXEL
88172.0 KKD
88173.0 LXRX
88177.0 APRI
88195.0 SGMO
88208.0 CLSN
88240.0 AEZS
88264.0 SONS
88332.0 CPST
88335.0 DNDN
88351.0 INSM
88371.0 REDF
88417.0 ACLS
88421.0 ARNA
88439.0 ENTG
88442.0 GGAL
88451.0 KERX
88457.0 NEI
88485.0 EVC
88511.0 CRIS
88516.0 DYAX
88532.0 ISPH
88535.0 ISTA
88537.0 IVAN
88574.0 TSYS
88581.0 VITA
88612.0 UMC
88626.0 DRRX
88645.0 SPIL
88646.0 STEC
88659.0 ASX
88790.0 ARRY
88791.0 BCON
88799.0 ESLR
88807.0 NVTL
88810.0 RIGL
88836.0 GNVC
88863.0 EXAS
88865.0 HAFC
88905.0 AIS
88906.0 ATPG
88945.0 GMXR
88992.0 GEN
89008.0 PNX
89018.0 GMR
89030.0 REVU
89031.0 TASR
89139.0 FRO
89148.0 RPC
89169.0 DCTH
89208.0 LAVA
89210.0 MCGC
89238.0 LYG
89256.0 NMR
89323.0 UCBI
89353.0 JBLU
89398.0 AUO
89399.0 ARO
89419.0 PACR
89445.0 BDSI
89452.0 QTWW
89471.0 LF
89505.0 PRAN
89548.0 NCT
89606.0 SWHC
89630.0 IAG
89685.0 NIHD
89692.0 KGC
89753.0 FORM
89768.0 MPG
89770.0 MSPD
89801.0 PRWT
89802.0 BRD
89805.0 CSE
89810.0 GPK
89841.0 CNO
89845.0 GRS
89863.0 MITI
89875.0 BPAX
89885.0 TIV
89898.0 OMEX
89903.0 AZK
89908.0 CONN
89911.0 IVN
89924.0 XPRT
89951.0 CGR
89965.0 NG
89976.0 AUY
90029.0 DVAX
90031.0 GTXI
90064.0 LSE
90079.0 ANDS
90098.0 CYCC
90101.0 ANX
90126.0 CYTK
90162.0 GNW
90175.0 XPO
90177.0 ACAD
90192.0 RJET
90196.0 XIDE
90201.0 HXM
90204.0 END
90209.0 JTX
90217.0 BEE
90243.0 INHX
90252.0 GKK
90271.0 PGH
90280.0 IDIX
90285.0 MNKD
90307.0 KRG
90325.0 STXS
90333.0 SNTS
90335.0 ALY
90343.0 RBY
90352.0 DYN
90354.0 OCLR
90384.0 MTL
90388.0 NRF
90397.0 YMI
90412.0 JRJC
90426.0 TWGP
90433.0 NGD
90436.0 HALO
90492.0 WRES
90493.0 AEA
90502.0 GSX
90527.0 NSU
90536.0 GFIG
90538.0 JRCC
90539.0 COOL
90547.0 ANR
90589.0 DRYS
90604.0 THLD
90606.0 BAA
90609.0 NOVL
90614.0 MEA
90618.0 PBW
90643.0 ACW
90678.0 CFW
90687.0 HDY
90695.0 TRE
90699.0 WMG
90724.0 EGLE
90727.0 FTWR
90733.0 LEAP
90743.0 NEWL
90744.0 SIMO
90748.0 XNPT
90757.0 FRG
90776.0 WAL
90780.0 AOB
90783.0 FTK
90795.0 JMBA
90813.0 GNK
90825.0 ABD
90854.0 AATI
90859.0 CMED
90885.0 GCA
90889.0 HRZ
90893.0 LCC
90907.0 SNSS
90921.0 CSA
90926.0 PIP
90939.0 SUF
90943.0 DHT
90951.0 HERO
90955.0 MELA
90965.0 NM
90968.0 ZLCS
90972.0 JSDA
90976.0 SEED
90978.0 SPWR
90984.0 WWWW
90994.0 ICO
91014.0 DLIA
91021.0 CYTX
91023.0 FREE
91028.0 SOMX
91037.0 AAV
91061.0 STP
91069.0 GST
91073.0 WNR
91109.0 XCO
91136.0 APP
91154.0 ALXA
91161.0 GPRE
91163.0 HIMX
91174.0 DDSS
91186.0 VNDA
91205.0 ZZ
91234.0 MWA
91237.0 VG
91270.0 CHTP
91283.0 RAME
91303.0 KOG
91305.0 PWE
91375.0 KAD
91376.0 AHD
91379.0 HUSA
91411.0 BQI
91418.0 GMO
91419.0 MHR
91422.0 URZ
91428.0 ASTI
91488.0 ZIOP
91491.0 ACHN
91495.0 CADX
91499.0 EROC
91582.0 MFG
91606.0 CPRX
91607.0 CSIQ
91612.0 GSAT
91613.0 HNSN
91616.0 NLST
91630.0 DVR
91635.0 DCT
91653.0 TSL
91655.0 ANW
91657.0 AFFY
91665.0 GLDD
91673.0 MPEL
91677.0 SOLF
91684.0 AOD
91689.0 EXK
91735.0 FRPT
91750.0 FIG
91814.0 ARAY
91819.0 JASO
91825.0 OPXT
91829.0 ROSG
91832.0 SNTA
91836.0 AVNW
91859.0 GFA
91889.0 BBND
91892.0 CLWR
91893.0 COIN
91900.0 GLUU
91928.0 DNN
91963.0 OCNF
91965.0 OREX
91976.0 ANV
91984.0 CXZ
91985.0 DEJ
92032.0 BIOD
92033.0 BNVI
92035.0 CLNE
92040.0 FOLD
92053.0 TOMO
92054.0 TWER
92089.0 BIOF
92095.0 INFN
92097.0 LLNW
92105.0 BZ
92126.0 LDK
92130.0 AEN
92150.0 VTG
92154.0 YGE
92178.0 JAG
92183.0 OWW
92186.0 ULU
92190.0 MF
92207.0 SHOR
92215.0 EXXI
92216.0 FEED
92227.0 SMBL
92244.0 EJ
92252.0 CUR
92254.0 PZG
92262.0 AXU
92266.0 CDII
92294.0 UEC
92300.0 CAST
92306.0 FUQI
92324.0 ABAT
92328.0 CSR
92346.0 PCX
92385.0 CIM
92389.0 ES
92393.0 GA
92395.0 HEK
92421.0 SD
92423.0 TC
92430.0 ARYX
92433.0 ETRM
92445.0 NSPH
92448.0 RBCN
92454.0 TNDM
92456.0 ATHX
92460.0 ENTR
92477.0 ARR
92517.0 XIN
92518.0 TNK
92519.0 APWR
92531.0 SHZ
92540.0 MDW
92543.0 SOL
92545.0 SSN
92571.0 LEI
92582.0 WZE
92589.0 KNDI
92594.0 RXII
92617.0 TAN
92619.0 GTE
92636.0 HTM
92665.0 RNN
92687.0 RSOL
92747.0 URG
92758.0 SOLR
92776.0 WPRT
92802.0 EBR
92806.0 CHBT
92858.0 EDZ
92864.0 ZSL
92875.0 HEAT
92893.0 SVM
92895.0 SAPX
92899.0 NIV
92917.0 BWEN
92932.0 UTA
92937.0 CBEH
92944.0 NEP
92947.0 DGW
93007.0 KITD
93031.0 REN
93037.0 AONE
93042.0 GAME
93048.0 YONG
93054.0 BSBR
93078.0 DRWI
93093.0 BTM
93106.0 CAK
93111.0 STRI
93128.0 COWN
93149.0 ZAGG
93179.0 PPC
93187.0 TAT
93238.0 CGC
93240.0 DEXO
93265.0 LLEN
93270.0 UNIS
93272.0 CALX
93297.0 BALT
93299.0 STNG
93300.0 ANTH
93301.0 AVEO
93337.0 VIP
93355.0 OCZ
93380.0 JKS
93382.0 NOR
93398.0 MILL
93418.0 ONE
93433.0 MOTR
93435.0 SCEI
0:33:19.622453

In [258]:
# If we interrupt the above...
h5f.close()

Checking on results


In [260]:
h5f = tbl.open_file("exchange_bids.h5", mode = "r")

In [272]:
h5f.root.p10180[0:50]


Out[272]:
array([ ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], 15668, 27000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [6.059999942779541], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [6.059999942779541], 15668, 30000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15668, 40000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], 15668, 70000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.050000190734863], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [6.039999961853027], 15668, 73000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15668, 83000),
       ([nan], [0.0], [6.059999942779541], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15668, 87000),
       ([nan], [0.0], [6.059999942779541], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15668, 90000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.059999942779541], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15668, 100000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.059999942779541], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15668, 217000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [5.949999809265137], [0.0], [0.0], [0.0], 15668, 430000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.039999961853027], 15668, 517000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], 15668, 730000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.059999942779541], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15668, 833000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.050000190734863], 15669, 860000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.039999961853027], 15674, 640000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.050000190734863], 15675, 110000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], 15678, 227000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], 15684, 163000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.039999961853027], 15686, 773000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], 15687, 170000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [5.940000057220459], [0.0], [0.0], [0.0], 15690, 467000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [5.96999979019165], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15694, 0),
       ([nan], [5.980000019073486], [0.0], [0.0], [0.0], [6.039999961853027], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15694, 37000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15694, 40000),
       ([nan], [0.0], [5.980000019073486], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15694, 43000),
       ([nan], [0.0], [5.980000019073486], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [6.039999961853027], 15694, 47000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.050000190734863], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15694, 80000),
       ([nan], [6.019999980926514], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15695, 57000),
       ([nan], [0.0], [6.039999961853027], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15695, 60000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], 15696, 293000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.050000190734863], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15696, 300000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.050000190734863], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15697, 150000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.050000190734863], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15704, 537000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15704, 547000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15704, 550000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [5.929999828338623], [0.0], [0.0], [0.0], 15705, 30000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15705, 550000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15705, 567000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], 15709, 923000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], 15710, 173000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], 15710, 177000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], 15710, 187000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], 15730, 697000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.050000190734863], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15741, 70000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.050000190734863], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15741, 73000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [6.070000171661377], [0.0], [0.0], [0.0], [0.0], 15750, 90000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [5.929999828338623], [0.0], [0.0], [0.0], 15750, 480000),
       ([nan], [6.019999980926514], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15757, 17000),
       ([nan], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], 15757, 20000)], 
      dtype=[('A', '<f4', (1,)), ('B', '<f4', (1,)), ('C', '<f4', (1,)), ('D', '<f4', (1,)), ('I', '<f4', (1,)), ('J', '<f4', (1,)), ('K', '<f4', (1,)), ('M', '<f4', (1,)), ('N', '<f4', (1,)), ('P', '<f4', (1,)), ('Q', '<f4', (1,)), ('S', '<f4', (1,)), ('T', '<f4', (1,)), ('W', '<f4', (1,)), ('X', '<f4', (1,)), ('Y', '<f4', (1,)), ('Z', '<f4', (1,)), ('time_mroot', '<i4'), ('time_mtrail', '<i4')])